// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Comment.cs" company="ecblog.codeplex.com">
//   emrecoskun.net - ibrahimatay.com
// </copyright>
// <summary>
//   The comment
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace EcBlog.Models
{
    using System;
    using System.ComponentModel.DataAnnotations;
    
    // using System.ComponentModel.DataAnnotations.Schema;

    using EcBlog.Properties;

    /// <summary>
    /// The comment
    /// </summary>
    public class Comment
    {
        /// <summary>
        /// Gets or sets the comment id.
        /// </summary>
        /// <value>
        /// The comment id.
        /// </value>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public long CommentId { get; set; }

        /// <summary>
        /// Gets or sets the name of the user.
        /// </summary>
        /// <value>
        /// The name of the user.
        /// </value>
        [Display(Name = "Name", ResourceType = typeof(ModelLocalization))]
        [Required(ErrorMessageResourceType = typeof(ModelLocalization),
            ErrorMessageResourceName = "ContactViewModel_Name_You_need_to_fill_in_a_name")]
        [StringLength(20)]
        public string UserName { get; set; }

        /// <summary>
        /// Gets or sets the email.
        /// </summary>
        /// <value>
        /// The email.
        /// </value>
        [Display(Name = "Email", ResourceType = typeof(ModelLocalization))]
        [Required(ErrorMessageResourceType = typeof(ModelLocalization),
            ErrorMessageResourceName = "ContactViewModel_Email_You_need_to_fill_in_an_email_address")]
        [StringLength(50)]
        [RegularExpression(@".+\@.+\..+")]
        public string Email { get; set; }

        /// <summary>
        /// Gets or sets the web.
        /// </summary>
        /// <value>
        /// The web.
        /// </value>
        [Display(Name = "Web", ResourceType = typeof(ModelLocalization))]
        [StringLength(50)]
        [RegularExpression(
            "^(ht|f)tp(s?)\\:\\/\\/[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\.\\?\\,\\\'\\/\\\\\\+&amp;%\\$#_]*)?$", 
            ErrorMessageResourceType = typeof(ModelLocalization),
            ErrorMessageResourceName = "Comment_Web_You_need_to_fill_in_an_web_address")]
        public string Web { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether [send response mail].
        /// </summary>
        /// <value>
        ///   <c>true</c> if [send response mail]; otherwise, <c>false</c>.
        /// </value>
        [Display(Name = "SendResponseMail", ResourceType = typeof(ModelLocalization))]
        public bool SendResponseMail { get; set; }

        /// <summary>
        /// Gets or sets the comment HTML.
        /// </summary>
        /// <value>
        /// The comment HTML.
        /// </value>
        [Display(Name = "Message", ResourceType = typeof(ModelLocalization))]
        [DataType(DataType.MultilineText), Required, StringLength(4000)]
        public string CommentHtml { get; set; }

        /// <summary>
        /// Gets or sets the page id.
        /// </summary>
        /// <value>
        /// The page id.
        /// </value>
        [ScaffoldColumn(false)]
        public long PageId { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is published.
        /// </summary>
        /// <value>
        ///     <c>true</c> if this instance is published; otherwise, <c>false</c>.
        /// </value>
        public bool IsPublished { get; set; }

        /// <summary>
        /// Gets or sets the created.
        /// </summary>
        /// <value>
        /// The created.
        /// </value>
        [Editable(false)][ScaffoldColumn(false)]
        public DateTime Created { get; set; }

        /// <summary>
        /// Gets or sets the last modified.
        /// </summary>
        /// <value>
        /// The last modified.
        /// </value>
        [ScaffoldColumn(false)]
        public DateTime LastModified { get; set; }

        /// <summary>
        /// Gets or sets the last modified user.
        /// </summary>
        /// <value>
        /// The last modified user.
        /// </value>
        [StringLength(50)]
        [ScaffoldColumn(false)]
        public string LastModifiedUser { get; set; }
    }
}